package com.come4loves.game.module.skill.buffImpl;

import java.util.Iterator;
import java.util.List;

import org.springframework.stereotype.Component;

import com.come4loves.game.dataconfig.model.BuffEffectConfig;
import com.come4loves.game.module.fight.action.BatchAction;
import com.come4loves.game.module.fight.action.BuffAction;
import com.come4loves.game.module.fight.constants.BuffType;
import com.come4loves.game.module.fight.model.BuffData;
import com.come4loves.game.module.fight.model.FightCard;
import com.come4loves.game.module.skill.AbstractBuffParser;
/**
 * 冲锋
 * @author jerry
 *
 */
@Component
public class ChargeImpl extends AbstractBuffParser {

	@Override
	public String buffId() {
		return "charge";
	}

	@Override
	public void parse(FightCard attackerCard,FightCard targetCard, BuffEffectConfig cfg, BatchAction batchAction) {
		List<BuffData> bufList = targetCard.getBuff(BuffType.SLEEP);
		if (bufList != null && !bufList.isEmpty()){
			Iterator<BuffData> it = bufList.iterator();
			while (it.hasNext()) {
				BuffData buffData = it.next();
				it.remove();
				BuffAction buffAction = new BuffAction(targetCard, buffData, 0);
				batchAction.addAction(buffAction);
				
			}
		}
		
	}

}
